<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: include/serial.hpp 源文件</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">serial.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../d1/dc5/serial_8hpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#ifndef __SERIAL_HPP__</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#define __SERIAL_HPP__</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span><span class="preprocessor">#include &lt;thread&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno">   16</span><span class="preprocessor">#include &lt;mutex&gt;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span><span class="preprocessor">#include &lt;type_traits&gt;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span><span class="preprocessor">#include &quot;<a class="code" href="../../d3/d9d/iserial_8hpp.html">details/iserial.hpp</a>&quot;</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../df/d8d/namespacewheels.html">wheels</a></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span>{</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="keyword">template</span>&lt; <span class="keyword">typename</span> T &gt;</div>
<div class="foldopen" id="foldopen00025" data-start="{" data-end="};">
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html">   25</a></span><span class="keyword">class </span><a class="code hl_class" href="../../d4/de7/classwheels_1_1t_serial.html">tSerial</a>: <span class="keyword">public</span> <a class="code hl_class" href="../../d2/da4/classwheels_1_1i_serial.html">iSerial</a></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span>{</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno">   27</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#ae1eb6d47df66b440a443bda7fbc47a0e">   28</a></span>    <span class="keyword">using </span><a class="code hl_typedef" href="../../d4/de7/classwheels_1_1t_serial.html#ae1eb6d47df66b440a443bda7fbc47a0e">realT</a> = <span class="keyword">typename</span> std::remove_pointer&lt; typename std::decay&lt; T &gt; ::type &gt;::type;</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno">   29</span>    <span class="keyword">static_assert</span>( std::is_base_of&lt;iSerial , realT &gt;::value , <span class="stringliteral">&quot;&quot;</span> );</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span>    </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span>    std::unique_ptr&lt; realT &gt;   pt_imp__;</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span><span class="keyword">public</span>:</div>
<div class="foldopen" id="foldopen00039" data-start="{" data-end="}">
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a73e281596218872016adee1680d66e94">   39</a></span>    <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a73e281596218872016adee1680d66e94">tSerial</a>( <span class="keyword">const</span> std::string&amp; name ){</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span>        <span class="keywordflow">try</span>{</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span>            pt_imp__.reset( <span class="keyword">new</span> <a class="code hl_typedef" href="../../d4/de7/classwheels_1_1t_serial.html#ae1eb6d47df66b440a443bda7fbc47a0e">realT</a>( name ) );</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span>        }<span class="keywordflow">catch</span>( std::bad_alloc&amp; e ){</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span>            <span class="keywordflow">throw</span> <a class="code hl_enumvalue" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383a89c845b1e9e073009724c86a746257ba">ERR_ALLOC_MEM</a>;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>        };</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    }</div>
</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span> </div>
<div class="foldopen" id="foldopen00056" data-start="{" data-end="}">
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#ad2e9e82d2a0800f09ea5af214789b9a3">   56</a></span>    <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#ad2e9e82d2a0800f09ea5af214789b9a3">tSerial</a>( <span class="keyword">const</span> std::string&amp; name ,<span class="keywordtype">int</span> baud ,<span class="keywordtype">int</span> char_len ,<a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#a5e585bb076d6a01c8c9cdab92e20c5ac">stop</a> s ,<a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ab1661c3535b0ca7149121b8b00dddca0">parity</a> p ,<a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#a86e499ffc36867fed86449541837b295">flow</a> f){</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span>        <span class="keywordflow">try</span>{</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span>            pt_imp__.reset( <span class="keyword">new</span> <a class="code hl_typedef" href="../../d4/de7/classwheels_1_1t_serial.html#ae1eb6d47df66b440a443bda7fbc47a0e">realT</a>( name , baud , char_len , s , p , f) );</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span>        }<span class="keywordflow">catch</span>( std::bad_alloc&amp; e ){</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span>            <span class="keywordflow">throw</span> <a class="code hl_enumvalue" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383a89c845b1e9e073009724c86a746257ba">ERR_ALLOC_MEM</a>;</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>        }</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>    }</div>
</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a60f901541b28cecab02e4133b7683dfd">   64</a></span>    <span class="keyword">virtual</span> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a60f901541b28cecab02e4133b7683dfd">~tSerial</a>(){}</div>
<div class="foldopen" id="foldopen00074" data-start="{" data-end="}">
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a90f1506ef984255632102f5f96c4d3fd">   74</a></span>    <span class="keyword">virtual</span> <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">err_code</a> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a90f1506ef984255632102f5f96c4d3fd">open</a>( <span class="keywordtype">int</span> baud , <span class="keywordtype">int</span> char_len , <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#a5e585bb076d6a01c8c9cdab92e20c5ac">stop</a> s , <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ab1661c3535b0ca7149121b8b00dddca0">parity</a> p , <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#a86e499ffc36867fed86449541837b295">flow</a> f ) <span class="keyword">final</span>{</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>        <span class="keywordflow">return</span> pt_imp__-&gt;open( baud , char_len , s , p , f );</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>    }</div>
</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span> </div>
<div class="foldopen" id="foldopen00078" data-start="{" data-end="}">
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a227706f07a251df72a7efadb48669dd9">   78</a></span>    <span class="keyword">virtual</span> <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">err_code</a> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a227706f07a251df72a7efadb48669dd9">close</a>() final{</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span>        <span class="keywordflow">return</span> pt_imp__-&gt;close();</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span>    }</div>
</div>
<div class="foldopen" id="foldopen00087" data-start="{" data-end="}">
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a21c9989eb705b839dd2621198413cc7f">   87</a></span>    <span class="keyword">virtual</span> <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">err_code</a> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a21c9989eb705b839dd2621198413cc7f">send</a>( <span class="keywordtype">size_t</span> len , <span class="keyword">const</span> <span class="keywordtype">char</span>* data ) <span class="keyword">final</span>{</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno">   88</span>        <span class="keywordflow">return</span> pt_imp__-&gt;send( len , data );</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno">   89</span>    }</div>
</div>
<div class="foldopen" id="foldopen00093" data-start="{" data-end="}">
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a49d25db90fbe011d03f001417a43ae51">   93</a></span>    <span class="keyword">virtual</span> <a class="code hl_class" href="../../d2/da4/classwheels_1_1i_serial.html">iSerial</a>&amp; <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a49d25db90fbe011d03f001417a43ae51">evtOpen</a>(  std::function&lt; <span class="keywordtype">void</span> (<a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">err_code</a>)&gt; fun ) <span class="keyword">final</span>{</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>        <span class="keywordflow">return</span> pt_imp__-&gt;<a class="code hl_function" href="../../d2/da4/classwheels_1_1i_serial.html#a3b795a5175156cdb27960db3b6ead564">evtOpen</a>( fun );</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span>    }</div>
</div>
<div class="foldopen" id="foldopen00096" data-start="{" data-end="}">
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a4e7ecee621e0ea0b728d969378cc8268">   96</a></span>    <span class="keyword">virtual</span> <a class="code hl_class" href="../../d2/da4/classwheels_1_1i_serial.html">iSerial</a>&amp; <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a4e7ecee621e0ea0b728d969378cc8268">evtClose</a>( std::function&lt; <span class="keywordtype">void</span> (<a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">err_code</a>)&gt; fun )<span class="keyword">final</span>{</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span>        <span class="keywordflow">return</span> pt_imp__-&gt;<a class="code hl_function" href="../../d2/da4/classwheels_1_1i_serial.html#ab8aca3b048eddae137fe5a329ce0da91">evtClose</a>( fun );</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>    }</div>
</div>
<div class="foldopen" id="foldopen00099" data-start="{" data-end="}">
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#ab10d43f10e14b6de6fa35fa2f983bf6a">   99</a></span>    <span class="keyword">virtual</span> <a class="code hl_class" href="../../d2/da4/classwheels_1_1i_serial.html">iSerial</a>&amp; <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#ab10d43f10e14b6de6fa35fa2f983bf6a">evtSend</a>(  std::function&lt; <span class="keywordtype">void</span> (<span class="keywordtype">size_t</span> , <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">err_code</a>)&gt; fun )<span class="keyword">final</span>{</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>        <span class="keywordflow">return</span> pt_imp__-&gt;<a class="code hl_function" href="../../d2/da4/classwheels_1_1i_serial.html#a7e98cc0bbb63d96c8033188ebefeb94e">evtSend</a>( fun );</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>    }</div>
</div>
<div class="foldopen" id="foldopen00102" data-start="{" data-end="}">
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a793df13a4061ac9fae3da1973c9a5e69">  102</a></span>    <span class="keyword">virtual</span> <a class="code hl_class" href="../../d2/da4/classwheels_1_1i_serial.html">iSerial</a>&amp; <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a793df13a4061ac9fae3da1973c9a5e69">evtRecv</a>(  std::function&lt; <span class="keywordtype">void</span> (<span class="keywordtype">size_t</span> , <span class="keyword">const</span> <span class="keywordtype">char</span>* , <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">err_code</a>)&gt; fun )<span class="keyword">final</span>{</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span>        <span class="keywordflow">return</span> pt_imp__-&gt;<a class="code hl_function" href="../../d2/da4/classwheels_1_1i_serial.html#a471a0264bf9600dc5b8305e9f409c812">evtRecv</a>( fun );</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span>    }</div>
</div>
<div class="foldopen" id="foldopen00108" data-start="{" data-end="}">
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#ab93078e80d178b29dfe7574d67ba087c">  108</a></span>    <span class="keyword">virtual</span> <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">err_code</a> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#ab93078e80d178b29dfe7574d67ba087c">reset</a>() final{</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>        <span class="keywordflow">return</span> pt_imp__-&gt;reset();</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span>    }</div>
</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno">  111</span> </div>
<div class="foldopen" id="foldopen00112" data-start="{" data-end="}">
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a928cf98c35d817f0fada6e73cdf0f22c">  112</a></span>    <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">err_code</a> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a928cf98c35d817f0fada6e73cdf0f22c">reset</a>( <span class="keywordtype">int</span> baud , <span class="keywordtype">int</span> char_len , <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#a5e585bb076d6a01c8c9cdab92e20c5ac">stop</a> s , <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#ab1661c3535b0ca7149121b8b00dddca0">parity</a> p , <a class="code hl_enumeration" href="../../d2/da4/classwheels_1_1i_serial.html#a86e499ffc36867fed86449541837b295">flow</a> f )<span class="keyword">final</span>{</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno">  113</span>        <span class="keywordflow">return</span> pt_imp__-&gt;reset( baud , char_len , s , p , f );</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno">  114</span>    }</div>
</div>
<div class="foldopen" id="foldopen00119" data-start="{" data-end="}">
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#adab34befe1989c529c3bdca090667573">  119</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#adab34befe1989c529c3bdca090667573">is_open</a>()final{</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno">  120</span>        <span class="keywordflow">return</span> pt_imp__-&gt;is_open();</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno">  121</span>    }</div>
</div>
<div class="foldopen" id="foldopen00126" data-start="{" data-end="}">
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#a7ffd8163efa9ca6986948ba0f246e8f6">  126</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a7ffd8163efa9ca6986948ba0f246e8f6">run</a>( <span class="keywordtype">bool</span> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a7ffd8163efa9ca6986948ba0f246e8f6">run</a> )<span class="keyword">final</span>{</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno">  127</span>        pt_imp__-&gt;run( <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#a7ffd8163efa9ca6986948ba0f246e8f6">run</a> );</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span>    }</div>
</div>
<div class="foldopen" id="foldopen00132" data-start="{" data-end="}">
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#ad16c2f986e64677c4318d8d623265e4e">  132</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#ad16c2f986e64677c4318d8d623265e4e">standby</a>()final{</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span>        pt_imp__-&gt;standby();</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span>    }</div>
</div>
<div class="foldopen" id="foldopen00135" data-start="{" data-end="}">
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#ae3289d3c1a6dae7bc87928dae415bcc4">  135</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#ae3289d3c1a6dae7bc87928dae415bcc4">SetBufferSize</a>( <span class="keywordtype">size_t</span> l )<span class="keyword">final</span>{</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>        pt_imp__-&gt;SetBufferSize( l );</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span>    }</div>
</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span> </div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"><a class="line" href="../../d4/de7/classwheels_1_1t_serial.html#ac0cb50ce1dca8871b3cbfb601be82390">  139</a></span>    <span class="keyword">virtual</span> native_handle_t <a class="code hl_function" href="../../d4/de7/classwheels_1_1t_serial.html#ac0cb50ce1dca8871b3cbfb601be82390">native_handle</a>(){ <span class="keywordflow">return</span> pt_imp__-&gt;native_handle(); }</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno">  140</span>};</div>
</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno">  141</span>}</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno">  142</span> </div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno">  144</span><span class="preprocessor">#if defined( __LINUX__ )</span></div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span><span class="preprocessor">#   include &quot;<a class="code" href="../../d2/dd8/linux_serial_8hpp.html">details/linuxSerial.hpp</a>&quot;</span></div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span><span class="keyword">using </span><a class="code hl_class" href="../../d8/dc6/classserial.html">serial</a> = <a class="code hl_class" href="../../d4/de7/classwheels_1_1t_serial.html">wheels::tSerial&lt; wheels::linuxSerial &gt;</a>;</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno">  147</span><span class="preprocessor">#elif defined( __WIN32 ) || defined( __WIN64 ) || defined( WINNT )</span></div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span><span class="preprocessor">#   include &quot;<a class="code" href="../../d4/d76/win_serial_8hpp.html">details/winSerial.hpp</a>&quot;</span></div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno">  149</span><span class="keyword">using </span><a class="code hl_class" href="../../d8/dc6/classserial.html">serial</a> = <a class="code hl_class" href="../../d4/de7/classwheels_1_1t_serial.html">wheels::tSerial&lt; wheels::winSerial &gt;</a>;</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno">  150</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno">  151</span> </div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno">  152</span><span class="preprocessor">#endif </span><span class="comment">// __SERIAL_HPP__</span></div>
<div class="ttc" id="aclassserial_html"><div class="ttname"><a href="../../d8/dc6/classserial.html">serial</a></div><div class="ttdoc">串口模块实现</div><div class="ttdef"><b>定义</b> <a href="../../d8/d9b/mandarava_2linux_2serial_8hpp_source.html#l00013">serial.hpp:14</a></div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html">wheels::iSerial</a></div><div class="ttdef"><b>定义</b> <a href="../../d3/d9d/iserial_8hpp_source.html#l00015">iserial.hpp:16</a></div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html_a3b795a5175156cdb27960db3b6ead564"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html#a3b795a5175156cdb27960db3b6ead564">wheels::iSerial::evtOpen</a></div><div class="ttdeci">virtual iSerial &amp; evtOpen(std::function&lt; void(err_code)&gt; fun)=0</div><div class="ttdoc">操作事件设置操作事件</div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html_a471a0264bf9600dc5b8305e9f409c812"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html#a471a0264bf9600dc5b8305e9f409c812">wheels::iSerial::evtRecv</a></div><div class="ttdeci">iSerial &amp; evtRecv(std::function&lt; void(size_t, const char *, err_code)&gt; fun)</div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html_a5e585bb076d6a01c8c9cdab92e20c5ac"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html#a5e585bb076d6a01c8c9cdab92e20c5ac">wheels::iSerial::stop</a></div><div class="ttdeci">stop</div><div class="ttdef"><b>定义</b> <a href="../../d3/d9d/iserial_8hpp_source.html#l00023">iserial.hpp:23</a></div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html_a7e98cc0bbb63d96c8033188ebefeb94e"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html#a7e98cc0bbb63d96c8033188ebefeb94e">wheels::iSerial::evtSend</a></div><div class="ttdeci">iSerial &amp; evtSend(std::function&lt; void(size_t, err_code)&gt; fun)</div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html_a86e499ffc36867fed86449541837b295"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html#a86e499ffc36867fed86449541837b295">wheels::iSerial::flow</a></div><div class="ttdeci">flow</div><div class="ttdef"><b>定义</b> <a href="../../d3/d9d/iserial_8hpp_source.html#l00025">iserial.hpp:25</a></div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html_ab1661c3535b0ca7149121b8b00dddca0"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html#ab1661c3535b0ca7149121b8b00dddca0">wheels::iSerial::parity</a></div><div class="ttdeci">parity</div><div class="ttdef"><b>定义</b> <a href="../../d3/d9d/iserial_8hpp_source.html#l00024">iserial.hpp:24</a></div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html_ab8aca3b048eddae137fe5a329ce0da91"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html#ab8aca3b048eddae137fe5a329ce0da91">wheels::iSerial::evtClose</a></div><div class="ttdeci">iSerial &amp; evtClose(std::function&lt; void(err_code)&gt; fun)</div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html_ac0046f5f91af625697c0474ae5084383"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383">wheels::iSerial::err_code</a></div><div class="ttdeci">err_code</div><div class="ttdef"><b>定义</b> <a href="../../d3/d9d/iserial_8hpp_source.html#l00027">iserial.hpp:27</a></div></div>
<div class="ttc" id="aclasswheels_1_1i_serial_html_ac0046f5f91af625697c0474ae5084383a89c845b1e9e073009724c86a746257ba"><div class="ttname"><a href="../../d2/da4/classwheels_1_1i_serial.html#ac0046f5f91af625697c0474ae5084383a89c845b1e9e073009724c86a746257ba">wheels::iSerial::ERR_ALLOC_MEM</a></div><div class="ttdeci">@ ERR_ALLOC_MEM</div><div class="ttdef"><b>定义</b> <a href="../../d3/d9d/iserial_8hpp_source.html#l00029">iserial.hpp:29</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html">wheels::tSerial</a></div><div class="ttdef"><b>定义</b> <a href="#l00025">serial.hpp:26</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a21c9989eb705b839dd2621198413cc7f"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a21c9989eb705b839dd2621198413cc7f">wheels::tSerial::send</a></div><div class="ttdeci">virtual err_code send(size_t len, const char *data) final</div><div class="ttdoc">发送数据。这个函数调用后立即返回，操作结果从回调中获取，因此这个函数执行返回后 并不一位置发送完成</div><div class="ttdef"><b>定义</b> <a href="#l00087">serial.hpp:87</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a227706f07a251df72a7efadb48669dd9"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a227706f07a251df72a7efadb48669dd9">wheels::tSerial::close</a></div><div class="ttdeci">virtual err_code close() final</div><div class="ttdef"><b>定义</b> <a href="#l00078">serial.hpp:78</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a49d25db90fbe011d03f001417a43ae51"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a49d25db90fbe011d03f001417a43ae51">wheels::tSerial::evtOpen</a></div><div class="ttdeci">virtual iSerial &amp; evtOpen(std::function&lt; void(err_code)&gt; fun) final</div><div class="ttdoc">操作事件设置操作事件</div><div class="ttdef"><b>定义</b> <a href="#l00093">serial.hpp:93</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a4e7ecee621e0ea0b728d969378cc8268"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a4e7ecee621e0ea0b728d969378cc8268">wheels::tSerial::evtClose</a></div><div class="ttdeci">virtual iSerial &amp; evtClose(std::function&lt; void(err_code)&gt; fun) final</div><div class="ttdef"><b>定义</b> <a href="#l00096">serial.hpp:96</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a60f901541b28cecab02e4133b7683dfd"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a60f901541b28cecab02e4133b7683dfd">wheels::tSerial::~tSerial</a></div><div class="ttdeci">virtual ~tSerial()</div><div class="ttdef"><b>定义</b> <a href="#l00064">serial.hpp:64</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a73e281596218872016adee1680d66e94"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a73e281596218872016adee1680d66e94">wheels::tSerial::tSerial</a></div><div class="ttdeci">tSerial(const std::string &amp;name)</div><div class="ttdoc">创建对象，设置窗口名称和接收到数据的时候回调响应</div><div class="ttdef"><b>定义</b> <a href="#l00039">serial.hpp:39</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a793df13a4061ac9fae3da1973c9a5e69"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a793df13a4061ac9fae3da1973c9a5e69">wheels::tSerial::evtRecv</a></div><div class="ttdeci">virtual iSerial &amp; evtRecv(std::function&lt; void(size_t, const char *, err_code)&gt; fun) final</div><div class="ttdef"><b>定义</b> <a href="#l00102">serial.hpp:102</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a7ffd8163efa9ca6986948ba0f246e8f6"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a7ffd8163efa9ca6986948ba0f246e8f6">wheels::tSerial::run</a></div><div class="ttdeci">virtual void run(bool run) final</div><div class="ttdoc">启动串口循环</div><div class="ttdef"><b>定义</b> <a href="#l00126">serial.hpp:126</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a90f1506ef984255632102f5f96c4d3fd"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a90f1506ef984255632102f5f96c4d3fd">wheels::tSerial::open</a></div><div class="ttdeci">virtual err_code open(int baud, int char_len, stop s, parity p, flow f) final</div><div class="ttdoc">打开串口。</div><div class="ttdef"><b>定义</b> <a href="#l00074">serial.hpp:74</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_a928cf98c35d817f0fada6e73cdf0f22c"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#a928cf98c35d817f0fada6e73cdf0f22c">wheels::tSerial::reset</a></div><div class="ttdeci">err_code reset(int baud, int char_len, stop s, parity p, flow f) final</div><div class="ttdef"><b>定义</b> <a href="#l00112">serial.hpp:112</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_ab10d43f10e14b6de6fa35fa2f983bf6a"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#ab10d43f10e14b6de6fa35fa2f983bf6a">wheels::tSerial::evtSend</a></div><div class="ttdeci">virtual iSerial &amp; evtSend(std::function&lt; void(size_t, err_code)&gt; fun) final</div><div class="ttdef"><b>定义</b> <a href="#l00099">serial.hpp:99</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_ab93078e80d178b29dfe7574d67ba087c"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#ab93078e80d178b29dfe7574d67ba087c">wheels::tSerial::reset</a></div><div class="ttdeci">virtual err_code reset() final</div><div class="ttdoc">复位串口。关闭串口重新打开</div><div class="ttdef"><b>定义</b> <a href="#l00108">serial.hpp:108</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_ac0cb50ce1dca8871b3cbfb601be82390"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#ac0cb50ce1dca8871b3cbfb601be82390">wheels::tSerial::native_handle</a></div><div class="ttdeci">virtual native_handle_t native_handle()</div><div class="ttdoc">读取系统</div><div class="ttdef"><b>定义</b> <a href="#l00139">serial.hpp:139</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_ad16c2f986e64677c4318d8d623265e4e"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#ad16c2f986e64677c4318d8d623265e4e">wheels::tSerial::standby</a></div><div class="ttdeci">virtual void standby() final</div><div class="ttdoc">结束串口消息循环</div><div class="ttdef"><b>定义</b> <a href="#l00132">serial.hpp:132</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_ad2e9e82d2a0800f09ea5af214789b9a3"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#ad2e9e82d2a0800f09ea5af214789b9a3">wheels::tSerial::tSerial</a></div><div class="ttdeci">tSerial(const std::string &amp;name, int baud, int char_len, stop s, parity p, flow f)</div><div class="ttdoc">创建并打开串口</div><div class="ttdef"><b>定义</b> <a href="#l00056">serial.hpp:56</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_adab34befe1989c529c3bdca090667573"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#adab34befe1989c529c3bdca090667573">wheels::tSerial::is_open</a></div><div class="ttdeci">virtual bool is_open() final</div><div class="ttdoc">串口是否打开</div><div class="ttdef"><b>定义</b> <a href="#l00119">serial.hpp:119</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_ae1eb6d47df66b440a443bda7fbc47a0e"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#ae1eb6d47df66b440a443bda7fbc47a0e">wheels::tSerial::realT</a></div><div class="ttdeci">typename std::remove_pointer&lt; typename std::decay&lt; T &gt; ::type &gt;::type realT</div><div class="ttdef"><b>定义</b> <a href="#l00028">serial.hpp:28</a></div></div>
<div class="ttc" id="aclasswheels_1_1t_serial_html_ae3289d3c1a6dae7bc87928dae415bcc4"><div class="ttname"><a href="../../d4/de7/classwheels_1_1t_serial.html#ae3289d3c1a6dae7bc87928dae415bcc4">wheels::tSerial::SetBufferSize</a></div><div class="ttdeci">virtual void SetBufferSize(size_t l) final</div><div class="ttdef"><b>定义</b> <a href="#l00135">serial.hpp:135</a></div></div>
<div class="ttc" id="aiserial_8hpp_html"><div class="ttname"><a href="../../d3/d9d/iserial_8hpp.html">iserial.hpp</a></div></div>
<div class="ttc" id="alinux_serial_8hpp_html"><div class="ttname"><a href="../../d2/dd8/linux_serial_8hpp.html">linuxSerial.hpp</a></div></div>
<div class="ttc" id="anamespacewheels_html"><div class="ttname"><a href="../../df/d8d/namespacewheels.html">wheels</a></div><div class="ttdoc">堆栈信息读取和保存记录</div><div class="ttdef"><b>定义</b> <a href="../../d3/df7/ary__str_8hpp_source.html#l00006">ary_str.hpp:7</a></div></div>
<div class="ttc" id="awin_serial_8hpp_html"><div class="ttname"><a href="../../d4/d76/win_serial_8hpp.html">winSerial.hpp</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
